#!/usr/bin/env python

import re
import sys

def strict_string(s):
    s = s.lower().replace('-', ' ')
    s = re.sub(r':(\S)', r': \1', s)
    s = re.sub(r'(\S)\(', r'\1 (', s)
    s = re.sub(r'\)(\S)', r') \1', s)
    s = re.sub(r'\s+\)', r')', s)
    s = re.sub(r'\(\s+', r'(', s)
    s = re.sub(r',\s+', r' ', s)
    s = re.sub(r';\s+', r' ', s)
    s = re.sub(r'([0-9])([a-z])', r'\1 \2', s)

    s = re.sub(r'\s+', ' ', s)
    s = s.strip()
    return s


def main():
    for line in sys.stdin:
        cnt, gene_func = line.strip().split(' ', 1)
        gene_func_stricted = strict_string(gene_func)
        print '%s\t%s\t%s' % (gene_func_stricted, cnt, gene_func)
    

if __name__ == "__main__":
    main()

